package com.woniuxy.controller;


import com.woniuxy.entity.TRoleMenu;
import com.woniuxy.entity.TWork;
import com.woniuxy.entity.Tr;
import com.woniuxy.entity.User;
import com.woniuxy.service.MenuService;
import com.woniuxy.service.PermissionControlService;
import com.woniuxy.service.impl.MenuServiceImpl;
import com.woniuxy.util.PageParam;
import com.woniuxy.util.ResponseData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.text.ParseException;
import java.util.List;

@RestController
@RequestMapping("permission")
public class PermissionControlController {
    @Autowired
    private PermissionControlService permissionControlService;

    @RequestMapping("/queryAllByDepId")
    public ResponseData<?> queryAllByDepId(@RequestBody PageParam<TWork> pageParam){
        return  permissionControlService.queryTrAllByDepId(pageParam);
    }
    @RequestMapping("updateManage")
    public  ResponseData<?> updateManage(@RequestBody TWork tWork){
      return  permissionControlService.updateManage(tWork);
    }
  @RequestMapping("queryAll")
    public  ResponseData<?> queryAll(){
        return  permissionControlService.queryAll();
  }
  @RequestMapping("queryAllMenus")
    public  ResponseData<?> queryAllMenu(@RequestBody TRoleMenu tRoleMenu)  {
       Integer userId= tRoleMenu.getUserId();
        return  permissionControlService.queryAllMenus(userId);
  }
  @RequestMapping("update")
    public  ResponseData<?> update( @RequestBody TRoleMenu tRoleMenu){
        return permissionControlService.update(tRoleMenu);



  }
  @RequestMapping("balDel/{id}")
    public  ResponseData<?> braDel(@PathVariable("id") Integer id){
        return permissionControlService.balDel(id);

  }

}
